<template>
	  <view class="sub-item" @click="todetail">
	    <image class="sub-image" mode="aspectFill" src="https://i-blog.csdnimg.cn/blog_migrate/8e64e93c7a590efe8490c43c052406df.png"></image>
	    <view class="info">
	      <progress class="sub-title">{{obj.title}}</progress>
	      <view class="meta">
	        <!-- <text class="views">{{obj.views || 20}} </text> -->
	        <!-- <text class="publisher">木木大学</text> -->
	        <text class="time">{{obj.updateTime}}</text>
	      </view>
	    </view>
	  </view>
</template>

<script>
	export default{
		name:"subItem",
		props:{
			obj:{
				type:Object,
				default:{}
			}
		},
		data(){
			return{
				
			}
		},methods:{
			getuser(){
				myrequest.getuserbyid(this.$store.state.token,this.$props.obj.id)
				.then(r=>{
					console.log("获取用户");
					console.log(r);
					this.creater = r.data.data
				})
			},
			todetail(){
				uni.navigateTo({
					url:"/pages/router/detail/detail"
				})
				setTimeout(()=>{
					uni.$emit("todetail",{obj:this.$props.obj})
				},1000)
			}
		},
		mounted() {
			// uni.$on("indexok",()=>{
			// 	setTimeout(this.getuser,100)
			// })
			
		},
		beforeDestroy() {
			// uni.$off("indexok")
		}
	}
</script>

<style>
	.sub-item {
	  flex: 1;
	  background: #fff;
	  border-radius: 12px;
	  overflow: hidden;
	  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	  transition: all .3s;
	}
	
	.sub-item:active{
		transform: translateY(-4px) scale(0.95);
		filter: brightness(0.9);
	    box-shadow: 0 4px 12px rgba(255 255, 255, 1);
	}
	
	.sub-image {
		width: 100%;
	  height: 120px;
	  /* height: 100%; */
	  background: linear-gradient(45deg, #ff416c, #ff4b2b);
	  position: relative;
	}
	
	.info {
	  padding: 12px;
	}
	
	.sub-title {
	  font-size: 14px;
	  margin: 0 0 10px 0;
	  line-height: 1.4;
	  height: 40px;
	  overflow: hidden;
	  display: -webkit-box;
	  -webkit-box-orient: vertical;
	  -webkit-line-clamp: 2;
	}
	
	.time{
		color: #666;
		font-size: 0.5em;
	}
</style>